[release/13.2] Fix TS AppHost restore config resolution#15625
[release/13.2] Fix TS AppHost restore config resolution#15625joperezr merged 2 commits intorelease/13.2from
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15625Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15625" |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🎬 CLI E2E Test Recordings — 52 recordings uploaded (commit View recordings
📹 Recordings uploaded automatically from CI run #23622073442 |
JamesNK
left a comment
There was a problem hiding this comment.
Nothing blocking. Some areas for improvement
|
|
||
| Assert.Equal("pr-new", channel); | ||
| } | ||
|
|
| var channelName = AspireConfigFile.Load(_appDirectoryPath)?.Channel | ||
| ?? AspireJsonConfiguration.Load(_appDirectoryPath)?.Channel; |
There was a problem hiding this comment.
This is duplicated in DotNetBasedAppHostServiceProject. Is there a place we could put a helper method to avoid duplication?
| config.Channel = inputs.Channel; | ||
| config.Save(outputPath); | ||
| } | ||
| config.Channel = inputs.Channel; |
There was a problem hiding this comment.
nit: Write a log message that channel has been set. Could be the comment above here
| var method = typeof(PrebuiltAppHostServer).GetMethod("ResolveChannelNameAsync", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); | ||
| Assert.NotNull(method); | ||
|
|
||
| var channelTask = Assert.IsType<Task<string?>>(method.Invoke(server, [CancellationToken.None])); | ||
| var channel = await channelTask; |
There was a problem hiding this comment.
Why reflection and not make the method internal?
There is also reflection in Constructor_UsesUserAspireDirectoryForWorkingDirectory test
Description
aspire newfor TypeScript AppHost projects was already triggering restore, but some of the first-run restore/code generation paths still read legacy.aspire/settings.jsoninstead of theaspire.config.jsonthat new templates produce. As a result, project-local channel and package resolution settings could be missed until a lateraspire restoreoraspire run.This change updates the TypeScript starter and guest AppHost server preparation paths to prefer
aspire.config.jsonwith legacy fallback preserved. It also persists the template SDK version before the automatic restore/code generation step so the initial generated project resolves integrations against the same version it was created with.The test updates cover the new-format config path in the starter flow and in both generated and prebuilt AppHost server channel resolution behavior.
Fixes #15413
Validation:
./dotnet.sh test tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj -- --filter-method "*.NewCommandWithTypeScriptStarterGeneratesSdkArtifacts" --filter-method "*.CreateProjectFiles_NuGetConfig_UsesProjectLocalChannel_NotGlobalChannel_MatchesSnapshot" --filter-method "*.ResolveChannelNameAsync_UsesProjectLocalAspireConfig_NotGlobalChannel" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"./dotnet.sh test tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj -- --filter-class "*.NewCommandTests" --filter-class "*.AppHostServerProjectTests" --filter-class "*.PrebuiltAppHostServerTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: